/*******************************************************************************

ATTENTION, this is an altered version of the xhtml_gen library, specifically tailored to libwebconf's needs please refer to the original library

xhtml_gen: xhtml generation library.
Copyright (c) 2006  Mitchel Haas

This software is provided 'as-is', without any express or implied warranty. 
In no event will the author be held liable for any damages arising from 
the use of this software.

Permission is granted to anyone to use this software for any purpose, 
including commercial applications, and to alter it and redistribute it freely, 
subject to the following restrictions:

1.	The origin of this software must not be misrepresented; 
you must not claim that you wrote the original software. 
If you use this software in a product, an acknowledgment in the product 
documentation would be appreciated but is not required.

2.	Altered source versions must be plainly marked as such, 
and must not be misrepresented as being the original software.

3.	The above copyright notice and this permission notice may not be removed 
or altered from any source distribution.

For complete documentation on this library, see http://www.datasoftsolutions.net
Email questions, comments or suggestions to mhaas@datasoftsolutions.net
*******************************************************************************/
#pragma once
#include "content.hpp"
#include "tag_trait.hpp"
#include "tag_trait_manager.hpp"
#include "xhtml_def.hpp"
#include "stylesheet_rule.hpp"
#include <map>
#include <set>
#include <sstream>
#include <stdexcept>

namespace xhtml_gen
{
class xhtml_element;
class tag_trait;
class xhtml_doc;

class tag : public content
{
private:
	tag();
	explicit tag(xhtml_strict _tag);
	~tag();

	// interface
	virtual content* clone() const { return new tag(*this); }
	virtual std::string get_xhtml(const int indent) const;
	virtual std::string get_end_tag(const int _indent) const;
	bool set_attribute( const attribute _attribute, const std::string& _value );
	bool set_style( const css_property _property, const std::string& _value );
	std::string get_attribute( const attribute _attribute ) const;
	std::string get_style( const css_property _property ) const;
	std::string get_attributes() const;
	std::string get_styles() const;
	xhtml_strict get_tag_enumeration() const;
	std::string get_tag_name() const;
	bool validate_nesting(const tag* pChild_tag) const;
	virtual const tag* get_tag() const { return this; }
	virtual tag* get_tag() { return this; }
	bool allow_cdata() const;
	nesting_type get_nesting_type() const;
	const tag_trait* get_tag_trait() const { return pTag_trait; }

	friend class xhtml_doc;
	friend class xhtml_element;


private:
	const tag_trait* pTag_trait;
	std::map<css_property, std::string >		styles;
	std::map<attribute, std::string >		attributes;
	static tag_trait_manager pTag_trait_mgr;
};

}

